/**
  ******************************************************************************
  * File Name          : ctrl_vfd.c
  * Description        : Code for data process applications
  ******************************************************************************
  * @attention
  *
  ******************************************************************************
  */

#ifndef __ctrl_vfd_H
#define __ctrl_vfd_H

#include <stdint.h>

#define CTRVFD_STORAGE_KEY           "CTRVFD"

#define CTR_VFD_MAXNUM    4

#define CTRVFD_QMSG_LENGTH          (CTR_VFD_MAXNUM * 4)
#define CTRVFD_QMSG_ITEMSIZE        sizeof(CtrVfd_QmsgType)

typedef struct
{
	uint8_t vfdid;
	uint8_t level;
	uint8_t src;
}CtrVfd_QmsgType;

typedef struct
{
	uint8_t level;
	uint8_t src;
}CtrVfd_SingleStateType;

typedef struct
{
	CtrVfd_SingleStateType state[CTR_VFD_MAXNUM];
}CtrVfd_StateType;

typedef struct
{
	uint8_t  en;                 /* 变频器总开关 */
	uint8_t  sort;
	uint8_t  tclevel;            /* 时控级数 */
}CtrVfd_PropertyType;

typedef struct
{
	uint8_t             effect;
	uint8_t             effct_num;           /* 有效数 */
	CtrVfd_PropertyType vfd[CTR_VFD_MAXNUM];
}CtrVfd_ParameterType;

typedef struct
{
	char key[8];
	CtrVfd_ParameterType para;
}CtrVfd_StorageType;

extern CtrVfd_StateType     CtrVfd_StateNow, CtrVfd_StateLast;
extern CtrVfd_ParameterType CtrVfd_RunPara,  CtrVfd_SetPara;
extern void    CtrVfd_SavePara(void);
extern uint8_t CtrVfd_LoadPara(void);
extern uint8_t CheckPara_CtrVfd(CtrVfd_ParameterType *para);

#endif
